import os
from ..common import (
  getJSONData
)
# 与英雄无用的键值
HERO_NODE_USELESS_KEY = [
  "heroId", "isWeekFree", "isARAMweekfree", "ispermanentweekfree", 
  "changeLabel", "goldPrice", "couponPrice", "camp", "campId", 
  "instance_id", "record_data", "position_info", 
  "roles_info"
]
# 与其他节点相关的键值
HERO_NODE_RELATIONSHIP_KEY = [
  "roles", "position"
]

# 数据的路径
DATA_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../data/hero')) + '/'


# 获取英雄的数据
def getHeroDataAndDeleteUselessAttr():
  # 拿到所有英雄的数据
  all_hero_data = getJSONData('hero_data.json', DATA_PATH)
  # 删除掉一些不要的数据
  for hero_data in all_hero_data:
    for key in HERO_NODE_USELESS_KEY:
      hero_data.pop(key)
  return all_hero_data

# 获取英雄的位置类型数据
def getHeroLocationData():
  location_data = getJSONData('location_node.json', DATA_PATH)
  return location_data

# 获取英雄的角色类型数据
def getHeroRoleData():
  role_data = getJSONData('role_node.json', DATA_PATH)
  return role_data


